package com.wzq.solution;

class Solution2 {
    public static int reverse(int x) {
        long rst = 0;

        while(x!=0){

            rst = rst*10 + x%10;
            if(rst > Math.pow(2,31)-1 || rst<-Math.pow(2,31)){
                return 0;
            }
            x = x/10;
        }

        return (int)rst;
    }

    public static void main(String[] args) {
        System.out.println(reverse(1534236469));
        //System.out.println(964632435*10+1>Math.pow(2,31)-1);
    }
}